import 'package:flutter_ducafecat_news/base/base_mvp_presenter.dart';
import 'package:flutter_ducafecat_news/common/apis/url_constants.dart';
import 'package:flutter_ducafecat_news/common/network/http_dio.dart';
import 'package:flutter_ducafecat_news/common/network/intercept/showloading_intercept.dart';
import 'package:flutter_ducafecat_news/pages/home/home_view.dart';

class HomePresenter extends BasePresenter<HomeView> {
  void getBannerList() {
    HttpDio.getInstance().get(
        UrlConstants.BANNERLIST,
        ShowLoadingIntercept(mView),
        (data) {
          mView.setBannerList(data);
        },
        params: {},
        errorCallBack: () {
          mView.setErrorWidgetVisible(true);
        });
  }

  void getIndexList() {
    HttpDio.getInstance()
        .get(UrlConstants.INDEXLIST, ShowLoadingIntercept(null), (data) {
      mView.setNewTruckList(data);
    }, params: {}, errorCallBack: () {});
  }
}
